#include "app_message.h"
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char const *argv[])
{
    uint8_t data[] = {0x01, 0x00, 0x00, 0x61, 0x45, 0x01, 0x01};
    char *json = app_message_bytesToJson((char *)data, sizeof(data));

    log_info("json:%s", json);
    free(json);

    char *json2 = "{\"device_id\":1,\"target_angle\": 3600, \"max_speed\": 60}";
    uint8_t bytes_buf[20] = {0};
    int data_len = app_message_jsonToBytes(json2, (char *)bytes_buf, sizeof(bytes_buf));

    printf("data_len:%d data: ", data_len);
    for (int i = 0; i < data_len; i++)
    {
        printf("%02x ", bytes_buf[i]);
    }
    printf("\n");
    return 0;
}
